<template>
  <div class="hawkContent">
    <!-- 面包屑 -->
    <hawk-breadcrumb></hawk-breadcrumb>
    <div class="center">
      <!-- 引入表单组件 -->
      <el-form :model="smsForm" ref="smsFormRef" :rules="smsFormRules"
               label-width="120px" class="sms_form">
        <el-form-item label="发件服务器" prop="smsServer">
          <!-- v-model="smsForm.smsServer" -->
          <el-input v-model="smsForm.smsServer" placeholder="请输入发件服务器"></el-input>

        </el-form-item>

        <el-form-item class="btn">
          <el-button type="primary" @click="submitForm">提交</el-button>
        </el-form-item>

      </el-form>
    </div>
  </div>
</template>

<script type="text/javascript">
/**
 * @author 秦秋雅
 * @description 告警配置下短信告警的视图层
 * @api /alarm/config/sms
 * @since 2021年11月08日 13:50
 * @update 2021年11月10日 15:50
 * @modifier 秦秋雅
 * @bug 无
 * @version v1.0.0
 */
import { smsSave } from '@/api/alarm/config/sms'
export default {
  data () {
    return {
      smsForm: {
        id: '',
        smsServer: ''
      },
      smsFormRules: {
        smsServer: [
          { required: true, message: '请输入发件邮箱', trigger: 'blur' }
        ]
      }
    }
  },
  // created() {
  //   this.switchType()
  // },
  methods: {
    // async switchType(type) {
    //   if (type || type == 0) this.type = type
    //   const { data } = await getInfo(this.type)
    //   this.type == 0
    //     ? (this.alarmForm = Object.assign({}, data))
    //     : (this.smsForm = Object.assign({}, data))
    // },
    //提交表单
    submitForm () {
      this.$refs.smsFormRef.validate(async valid => {
        console.log(valid)
        if (!valid) return
        let ret = await smsSave(this.smsForm)
        console.log(ret);

      })
    }
  }
}
</script>

<style lang="scss" scoped>
.center {
  width: 700px;
  margin: 0 auto;
  margin-top: 120px;
  .btn {
    display: flex;
    justify-content: flex-end;
  }
}
</style>
